草庐IT

Java Selenium Chromedriver.exe 不存在 IllegalStateException

全部标签

c# - 命名空间 'Hosting' 中不存在类型或命名空间名称 'Microsoft.AspNetCore.Razor'

我使用VisualStudio.NETCore2.1SDK+React模板创建了一个项目。我在运行项目时遇到了以下错误:Oneormorecompilationreferencesaremissing.Ensurethatyourprojectisreferencing'Microsoft.NET.Sdk.Web'andthe'PreserveCompilationContext'propertyisnotsettofalse.Thetypeornamespacename'Hosting'doesnotexistinthenamespace'Microsoft.AspNetCore.R

c# - 检查驱动器是否存在(字符串路径)

如何根据WPF中的给定字符串检查系统中是否存在驱动器。我尝试了以下方法示例:FileLocation.Text="K:\TestDrive\XXX";if(!Directory.Exists(FileLocation.Text)){MessageBox.Show("InvalidDirectory","Error",MessageBoxButton.OK);return;}它正在检查完整路径,但它应该检查文本中的“K:\”。你能指导我吗编辑1:“K:\TestDrive\XXX”不是静态的编辑2:我尝试了以下操作,在我的系统中我有3个驱动器C、D和E但它显示false.Environm

c# - XML 解析检查属性是否存在

我创建了一个方法来检查XML文件中是否存在属性。如果不存在,则返回“False”。它可以工作,但是解析文件需要很长时间。它似乎为每一行读取整个文件。我在这里错过了什么吗?我能否以某种方式使其更有效?publicstaticIEnumerablegetXML(stringXMLpath){XDocumentxmlDoc=XDocument.Load("spec.xml");varspecs=fromspecinxmlDoc.Descendants("spec")selectnewRowData{number=(string)spec.Attribute("nbr"),name=(stri

c# - 为什么 Process.Start ("cmd.exe", process);不行?

这个有效:Process.Start("control","/nameMicrosoft.DevicesAndPrinters");但这不会:(它只是打开一个命令提示符。)ProcessStartInfoinfo=newProcessStartInfo("cmd.exe");info.Arguments="control/nameMicrosoft.DevicesAndPrinters";Process.Start(info);为什么?(是的,我知道它们并不相同。但第二个“应该”有效。) 最佳答案 这是因为cmd.exe需要/K开关

c# - 无法确定具有指定格式名称的队列是否存在

执行以下代码时出现异常。有什么想法吗?stringqueueName="FormatName:Direct=TCP:1.1.1.1\\Private$\\test";MessageQueuequeue;if(MessageQueue.Exists(queueName))queue=newSystem.Messaging.MessageQueue(queueName);elsequeue=MessageQueue.Create(queueName);queue.Send(sWriter.ToString());编辑:这是异常消息和堆栈跟踪的第一行Cannotdeterminewhethe

c# - 如何检查 .NET 中是否存在文化

我有这段代码,当我尝试获取不存在的文化时出现异常。是否存在像TryGetCultureInfo这样返回bool值的方法?我不想使用try-catch语句CultureInfoculture=CultureInfo.GetCultureInfo(cultureCode);if(culture==null){culture=CultureInfo.GetCultureInfo(DefaultCultureCode);} 最佳答案 您可以像这样编写一个返回bool值的DoesCultureExist方法:privatestaticbool

c# - Server.MapPath 在当前上下文中不存在

在我的MVC4项目中我有命名空间prj.MVC4.Controllers在我使用Server.MapPath(..)的地方没有问题并且在prj.MVC4.ModelsServer.MapPath(...)在当前上下文中不存在。我知道Server.MapPath驻留在System.Web中,并且使用System.Web将命名空间和程序集添加到类中>并将System.Web.dll添加到prj。Ctrl+.。我正在获取Microsoft.SqlServer作为要添加的建议命名空间。如何解决这个问题? 最佳答案 服务器是Controlle

c# - 通过 ExecuteNonQuery 检查表中的记录是否存在于数据库中

在我的程序中,我需要使用if语句检查数据库中的记录是否已存在于表中。使用c#我正在尝试通过sql连接来执行此操作。因为我假设ExecuteNonQuery();命令返回一个整数值,如果我的假设是真的,我想知道什么值是真的知道表中是否存在某个记录。这是我的代码示例:using(SqlConnectionsqlConnection=dbUtil.GetSqlConnection(dbUtil.GetConnectionStringByName("NonConnectionString"))){using(SqlCommandsqlCommand=newSqlCommand("SELECT*

c# - 命名空间 'Linq' 中不存在类型或命名空间名称 'System'

这个问题在这里已经有了答案:Thetypeornamespacename'Linq'doesnotexistinthenamespace'System'(10个答案)关闭5年前。当我想使用按钮在C#中编写代码时,它不会转到“.cs”文件来编写C#代码。当我检查项目源时,我发现了这个错误:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;SeverityCodeDescriptionPr

c# - 命名空间中不存在类型或命名空间名称 'DirectoryServices'?

CS0234:Thetypeornamespacename'DirectoryServices'doesnotexistinthenamespace'System'(areyoumissinganassemblyreference?)此页面运行良好,显示直接来自服务的记录没有错误。但现在它给出了上述错误。/Columns>项目构建成功,但是当我打开页面时出现错误 最佳答案 添加目录服务引用后,右键单击reference并转到properties。将"CopyLocal"设置为true。